package com.qf.md.unit.dao;

import com.qf.entity.md.unit.MdUnitMeasure;
import com.qf.md.unit.param.DownLoadParam;
import com.qf.md.unit.param.UnitSearchParam;
import com.qf.md.unit.vo.MeasureIdAndPrimaryIdVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @author zdl
 * @date 2025/2/27
 */
public interface MdUnitMeasureDao {
    /**
     * 分页查询单表md_unit_measure + 模糊查询
     * @param unitSearchParam
     * @return
     */
    List<MdUnitMeasure> selectMeasurePage(UnitSearchParam unitSearchParam);

    /**
     * 根据measureId 删除
     * @param measureId
     * @return
     */
    Long delMeasureByMeasureId(Long measureId);

    /**
     * 批量删除
     * @param ids
     * @return
     */
    Long delBatchMeasureByIds(List<Long> ids);

    /**
     * 新增
     * @param mdUnitMeasure
     * @return
     */
    Long addMeasure(MdUnitMeasure mdUnitMeasure);

    /**
     * 根据id查询 对象
     * @param measureId
     * @return
     */
    MdUnitMeasure selectByPrimaryKey(Long measureId);

    /**
     * 更新
     * @param mdUnitMeasure
     * @return
     */
    Long updateMeasure(MdUnitMeasure mdUnitMeasure);

    /**
     * 根据measureCode 或 measureName查询
     * @param measureCode
     * @param measureName
     * @return
     */
    MdUnitMeasure selectByMeasureName(@Param("measureCode") String measureCode, @Param("measureName") String measureName);

    /**
     * 查询所有主单位
     * @return
     */
    List<MdUnitMeasure> selectByPrimaryFlag();

    /**
     * 查询主单位下的非主单位
     * @param measureId
     * @return
     */
    List<MeasureIdAndPrimaryIdVO> selectMeasureIdAndPrimaryId(Long measureId);

    MdUnitMeasure selectByMeasureId(Long  primaryId);

    /**
     * 批量插入
     * @param cachedDataList
     * @return
     */
    Long uploadBatchExcel(List<MdUnitMeasure> cachedDataList);

    /**
     * 导出
     * @return
     */
    List<DownLoadParam> downloadExcel();
}
